package com.one.square.gateway.fegin.user;

import com.one.square.core.domain.Result;
import com.one.square.core.entity.SysMenu;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.Future;

/**
 * @author cwm
 * @Description 异步Menu服务
 * @date 2021/10/27 上午9:48
 * @Version 1.0
 */
@Component
public class AsynMenuService {
    @Lazy
    @Resource
    private SysMenuService menuService;

    @Async
    public Future<List<SysMenu>> findByRoleCodes(List<String> roleCodes) {
        Result<List<SysMenu>> result = menuService.findByRoleCodes(roleCodes);
        return new AsyncResult<>(result.getData());
    }
}
